<template>
	<view class="content">
		<uni-list v-for="(item,index) in list" :key="index">
			<uni-badge :text="item.id" type="error" absolute='rightTop' :offset=[20,50]>
				<uni-list-item 
				:title="item.name" 
				:note="item.department" 
				:thumb="`../../static/cat-${item.id}.png`" 
				thumbSize="lg">
				</uni-list-item>
		    </uni-badge>
		</uni-list>
		<button type="primary" @click="comment" style="margin-top: 5px;">发表评论</button>
		
		<button type="primary" @click="comments" style="margin-top: 5px;">查看评论</button>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
			
				list: [
					
                  ]
				
				

			}
		},
	  
		onLoad() { 
			uni.request({
				url:'http://localhost:8090/freshmenapp/user/list',
				method:'post',
				data:{},
				success:res=>{
					if(res.data.list){
						this.list=res.data.list
					}
				}
			})
		},
		methods: {
			
				comments(){
					uni.navigateTo({
						url:'/pages/index/comments'
					})
				},
				comment(){
					uni.navigateTo({
						url:'/pages/index/comment'
					})
				}
			}
		
		}
	
</script>

<style>
	.content {
		/* 
		flex-direction: column;
		align-items: center;
		justify-content: center; */
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
		position: relative;
		/* display: flex; */
	}
	
</style>